const Mock = require('mockjs')

const List = []
const count = 100

const baseContent = '<p>I am testing data, I am testing data.</p><p><img src="https://wpimg.wallstcn.com/4c69009c-0fd4-4153-b112-6cb53d1cf943"></p>'
const image_uri = 'https://wpimg.wallstcn.com/e4558086-631c-425c-9430-56ffb46e70b3'

const areaList = [
  {
    code:"340000",
    name:"安徽省",
    nodes:[
      {code:"340100",name:"合肥市",nodes: [
          {code:"340104",name:"蜀山区",nodes:[{code:'340104001',name:"梦园小区",nodes:[{code:'340104001001',name:"1栋"}]}]},
          {code:"340111",name:"包河区",nodes:[{code:"340111001",name:"湖公馆",nodes:[{code:'340111001001',name:"2栋"}]}]},
          {code:"340102",name:"瑶海区",nodes:[{code:'340102001',name:"中绿广场",nodes:[{code:'340102001001',name:"15层"}]}]}
        ]}
    ]
  }
]

const areas = [
  {id:101,name:"1栋",type:2,path:['340000','340100','340104','340104001'],code:"340104001001",address:"安徽省/合肥市/蜀山区/梦园小区",create_time:+Mock.Random.date('T') },
  {id:101,name:"2栋",type:2,path:['340000','340100','340111','340111001'],code:"340111001001",address:"安徽省/合肥市/包河区/湖公馆",create_time:+Mock.Random.date('T') },
  {id:101,name:"1栋",type:2,path:['340000','340100','340102','340102001'],code:"340102001001",address:"安徽省/合肥市/瑶海区/中绿广场",create_time:+Mock.Random.date('T') },
]

const communityList = [
  {
    code:"340000",
    name:"安徽省",
    nodes:[
      {code:"340100",name:"合肥市",nodes: [
          {code:"340104",name:"蜀山区",nodes:[{code:'340104001',name:"梦园小区"}]},
          {code:"340111",name:"包河区",nodes:[{code:"340111001",name:"湖公馆"}]},
          {code:"340102",name:"瑶海区",nodes:[{code:'340102001',name:"中绿广场"}]}
        ]}
    ]
  }
]

module.exports = [
  {
    url: '/area/tree',
    type: 'get',
    response: config => {
      return {
        code: 20000,
        data: areaList
      }
    }
  },
  {
    url: '/area/list',
    type: 'get',
    response: config => {
      return {
        code: 20000,
        data: {
          list:areas,
          total:areas.length
        }
      }
    }
  },
  {
    url: '/area/communities',
    type: 'get',
    response: config => {
      return {
        code: 20000,
        data: communityList
      }
    }
  },
  {
    url: '/area/delete',
    type: 'post',
    response: config => {
      return {
        code: 20000,
        data: ''
      }
    }
  },
  {
    url: '/area/add',
    type: 'post',
    response: config => {
      return {
        code: 20000,
        data: ''
      }
    }
  }
]

